<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <title>魏远商城</title>
    <link rel="stylesheet" type="text/css" href="../../css/common/public.css" />
    <link rel="stylesheet" type="text/css" href="../../css/home/hot.css" />
    <link rel="stylesheet" type="text/css" href="../../assets/swiper-3.4.2.min.css"/>
    <!--<link rel="stylesheet" type="text/css" href="../../css/common/public.css" />-->   
    <script src="../../assets/swiper-3.4.2.min.js"></script>
    <script src="../../assets/jquery-3.1.1.min.js"></script>
    <!--<script src="../../js/public.js"></script>-->
</head>
<body>
	<div class="top_all">
		<div class="top">
			<div class="top_con">
				<div class="tlogin"></div>
				<div class="gotoregister" style="display: none;">免费注册</div>
				<div class="homepage">商城首页</div>
				<div class="tmyorder">我的订单<img src="../../image/turn_down.png"></div>						
				<div class="home_car"><img src="../../image/shop_car.png">购物车<span class="car_time">0</span></div>
				<div class="line_ke">联系客服<img src="../../image/turn_down.png"></div>							
			</div>		
		</div>
		<div class="loged" style="display: none;">
			<div><span class="guanli">账号管理</span>|<span class="out">退出</span></div>
			<div class="thead">
				<div class="thead_pic"><span></span></div>
				<div class="tmenber">企业会员</div>
			</div>
		</div>
		<div class="myorder">
			<span class="order_1">待支付</span>
			<span class="order_2">待发货</span>
			<span class="order_3">待收货</span>
			<span class="order_4">待评价</span>
		</div>
		<div class="tcont">
			<span class="mine1">用户帮助</span>
			<span class="mine2">联系客服</span>
			<span class="mine3">投诉建议</span>
			<span class="mine4">退换货</span>
			<span class="mine5">收货地址管理</span>
		</div>
		
		<div class="logeandsear">
			<div class="imageLogo"><img src="../../image/Logo.png"></div>
			<div class="search">
				<div>
					<img class="search-icon" src="../../image/search-icon.png"><input type="text" class="home_searchto" placeholder="魏远产品搜索" /><span class="gotosearch">搜索</span>
				</div>
			</div>
	    </div>
	</div>	
	<div class="right">
			<div class="right_car"><span><img src="../../image/righr_car.png"></br>购</br>物</br>车</span></div>
		<div class="youhuiquan"><span>优</br>惠</br>券</span></div>
		<div class="qianbao"><span>钱</br>包</span></div>
		<div class="qiyeshangc"><span>企</br>业</br>商</br>城</span></div>
		<div class="totop"><span><br/>^<br/>TOP</span></div>
	</div>
	
	<div class="wrap">
		<div class="select">
			<div>
				<span class="alltype">全部商品分类</span>
				<span  class="home_hot">热销爆款</span>
				<span class="home_new">新品速递</span>
				<span class="home_acv">营销活动</span>
				<span class="home_topg">优品馆</span>
				<!--李勇-->
					<div class="downtypeg" style="display: none;">
						<div class="downtypegdivall">
							<div class="downtypegdiv"></div>						
							<div class="downcatediv" style="display: none;"></div>						
						</div>
				    </div>
					<!--李勇结束-->
				<!--<div class="downtypeg"  style="display: none;">
					
				</div>-->
			</div>
		</div>
		
		
		<div class="clas_conall">
			<!--<div class="clas_con">
				<div class="hot_title">
				     <span class="hot_titles">服饰特卖<span>时尚青春，服饰品牌</span></span>
			    </div>
			    <div class="clas_con_danall">
					<div class="clas_con_dan">
						
						<div class="clas_content">
							<div class="con_danpic">
								
							</div>
							<p>阿斯达所大所大所多</p>
							<p>￥<span>100</span></p>
						</div>
						<div class="c_shadow">
							<span></span>
							<span></span>
						</div>
					</div>
				
				
				    
				</div>
		
			</div>	-->
		</div>
	
		
		
	</div>
    <div class="wrap">
		<div class="wrap_bottom"><img src="../../image/bottom.png"></div>
	</div>
<script type="text/javascript" src="../../js/url.js"></script>
<script>
	 $('.downtypeg').css('height','500px');
	 

     $('.clas_conall').on('click','.lookmore',function () {
//   	alert($(this).attr('id'));
        localStorage.wyshophometomotomore = $(this).attr('id');
         window.location.href='../home/homemeltodetails.html';
     })



    $('.clas_conall').on('click','.clas_con_dan', function() {
    	var a =  $(this).parents('.clas_con').find('.hot_titles').text().replace('查看更多','');
    	localStorage.wyshopwhatclass = a; 
        whereto($(this).attr('id'));
	});
	
    function whereto(wid){
    	
    	localStorage.wyshopwheredetails = wid;
    	window.location.href='../goods/detalis.html';
    };



      showlist();
    function showlist() {
//									alert(localStorage.wyshopwheretypeb);
				
				if(localStorage.wyshopwheretypeb == 66) {
//					$('.hot_titles').text('营销活动');
					$('.home_hot').css('color','#eaaf27');
				} else if(localStorage.wyshopwheretypeb == 65) {
					$('.home_new').css('color','#eaaf27');
				} else if(localStorage.wyshopwheretypeb == 59) {
					$('.home_acv').css('color','#eaaf27');
				} else if(localStorage.wyshopwheretypeb == 64) {
					$('.home_topg').css('color','#eaaf27');
				}
				$.ajax({
					url: ur + '/mobile/product/getMarketingProductList',
					type: 'POST',
					headers: {
						"X-Token": localStorage.token,
					},
					dataType: 'json',
					data: {
						"num": localStorage.wyshopwheretypeb 
					},
					success: function(data) {
						
						
						for(var i = 0; i < data.categoryStrs.length; i++) {

//							var div = ('<div class="hone-recommend" style="margin-bottom: 0;"> ' +
//								'<p style="text-align: center;">—— ' + data.categoryStrs[i] + ' ——</p> ' +
////								'<p id="' + i + '" class=""></p> ' +
//								'<div class="home-se' + i + ' home-se">' +
//								'</div> </div>');
								
							var div = ('<div class="clas_con">'+
										'<div class="hot_title">'+
										     '<span class="hot_titles">' + data.categoryStrs[i] + '<span class="lookmore" id="'+i+'">查看更多</span></span>'+
									    '</div>'+
									    '<div class="clas_con_danall clas_con_danall' + i + '">'+
//											'<div class="clas_con_dan">'+
//												
//												'<div class="clas_content">'+
//													'<div class="con_danpic">'+
//														
//													'</div>'+
//													'<p>阿斯达所大所大所多</p>'+
//													'<p>￥<span>100</span></p>'+
//												'</div>'+
//												'<div class="c_shadow">'+
//													'<span></span>'+
//													'<span></span>'+
//												'</div>'+
//											'</div>'+
										'</div>'+
									'</div>');
								
								
							$('.clas_conall').append(div);

							var keys = 'category' + i;
							console.log(data[keys].length);
							if(data[keys].length<8){
								var lengthshow = data[keys].length;
							}else if(data[keys].length>8){
								var lengthshow = 8;
							}
							for(var y = 0; y < lengthshow; y++) {
								var b = data[keys][y].mainImg;
								console.log(b.indexOf(',') + '逗号索引值');
								var m = b.indexOf(',');
								if(m != '-1') {
									var mainImg = b.substring(0, m);
								} else {
									mainImg = b;
								}
//								var divdan = ('<div class="home-dan" id=' + data[keys][y].id + '> ' +
//									'<div class="home-picd" style="background-image: url(' + picur + mainImg + ');background-position: center;background-repeat: no-repeat;background-size: cover;"></div> ' +
//									'<p>' + data[keys][y].longname + '</p> ' +
//									'<p>' + data[keys][y].shortname + '</p>' +
//									'<p>¥<span style="font-size: 1rem;">' + data[keys][y].newPrice + '</span>' +
//									//									'<span class="home-add"><img src="img/add.png" alt="" width="50%"/></span>' +
//									'</p> ' +
//									'</div>');
									
								var divdan = $('<div class="clas_con_dan" id=' + data[keys][y].id + '>'+
//												
												'<div class="clas_content">'+
													'<div class="con_danpic" style="background-image: url(' + picur + mainImg + ');background-position: center;background-repeat: no-repeat;background-size: cover;">'+
														
													'</div>'+
													'<p>' + data[keys][y].shortname + '</p>'+
													'<p>￥<span>' + data[keys][y].newPrice + '</span></p>'+
												'</div>'+
												'<div class="c_shadow">'+
													'<span></span>'+
													'<span></span>'+
												'</div>'+
											'</div>');
									
									
								$('.clas_con_danall' + i + '').append(divdan);
							}
						}
					},
					 error:function(){
					 	
					 }
				});
			}


             

          

</script>
</body>
</html>
